/**
 * 工具函数
 *///require("../../fonts/iconfont.css");
 require('../../fonts/iconfont.css');
 require('../../fonts1/iconfont.css');
 require("../../font4/iconfont.css")
 const username="http://139.9.177.51:8099";

function phonefn(phone){
    return  /^1[3-9]\d{9}$/.test(phone);
}

function pasfn(pas1){
    return /^[a-zA-Z]\w{5,17}$/.test(pas1)
}


// window.$$2={
//     pasfn1:pasfn,
// }
//这是模态框的抽取函数区域
function showmask(data1='correct-1-mini',data2='操作成功',spend=3000,){
    let body=document.body
   let div=document.createElement('div');
   div.innerHTML=`<span class="iconfont icon-${data1}"></span>
    <p>${data2}</p>`;
  div.className='mask'
  body.appendChild(div);
  window.setTimeout(function(){
  div.remove()
  },spend)
}
//这是脚抽取区域
  function footer(data){
      let footer=document.querySelector('#footer');
      let div1=document.createElement('div');
      div1.innerHTML=` <a href='./home.html' class='${data=='home'?'active':''}'>
      <span class='iconfont icon-shouye'></span>
      <p>首页</p>
      <a href='./echarts.html' class='${data=='exercise'?'active':''}'>
      <span class='iconfont icon-xin-copy'></span>
      <p>运动</p>
      </a>
      <a href='./my.html' class='${data=='my'?'active':''}'>
      <span class='iconfont icon-wode'></span>
      <p>我的</p>
      </a>
          `
          footer.appendChild(div1)
  };

  //这是课程U训练函数抽取区域
   function curricular(data2){
      let div2=document.createElement('div');
          div2.className="headerdiv";
      let body=document.querySelector('.exercise_main_header');
      let exercise_main=document.querySelector(".new_couese");
        div2.innerHTML=` 
         <a href='#' class='${data2==='exercise'?'active2':''}'>跑步</a>
         <a href='#' class='${data2==='exercise'?'active2':''}'>骑行</a>
         <a href='#' class='${data2==='exercise'?'active2':''}'>课程训练</a>
        `
        body.insertBefore(div2,exercise_main)
   };

//这是生日拼零的调用函数区域
function birparty(n){
    return n<10?"0"+n:n;
}
//这是日期对象的函数的调用区域的开始
function get(time){
  let time1=new Date();
  let y=time1.getFullYear();
  let m=time1.getMonth()+1;
  let d=time1.getDay();
  return [y,birparty(m),birparty(d)].join('-')
}


window.$$={
    phonefn: phonefn,
    pasfn1:pasfn,
    username:username,
    showmask:showmask,
    footer:footer,
    curricular:curricular,
    birparty:birparty,
    get:get,
    
}     